]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
animation: Add dedicated Spinner class
authorFlorian Müllner <fmuellner@gnome.org>
Wed, 28 Nov 2018 15:41:09 +0000 (16:41 +0100)
committerFlorian Müllner <florian.muellner@gmail.com>
Wed, 16 Jan 2019 17:44:42 +0000 (17:44 +0000)
We use AnimatedIcon with the same resource all over the place, cut
down on the duplication by providing a dedicated class.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/316

js/gdm/authPrompt.js
js/ui/animation.js
js/ui/components/keyring.js
js/ui/components/polkitAgent.js
js/ui/status/network.js

index a0a4a21d677e548e820f30c0d18a38bcfac7f83c..fcb1a585b273b2a90df2ab6826f244d9f87c2aa8 100644 (file)
@@ -127,8 +127,7 @@ var AuthPrompt = new Lang.Class({
 
         this._initButtons();
 
-        let spinnerIcon = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/process-working.svg');
-        this._spinner = new Animation.AnimatedIcon(spinnerIcon, DEFAULT_BUTTON_WELL_ICON_SIZE);
+        this._spinner = new Animation.Spinner(DEFAULT_BUTTON_WELL_ICON_SIZE);
         this._spinner.actor.opacity = 0;
         this._spinner.actor.show();
         this._defaultButtonWell.add_child(this._spinner.actor);
index fbd2cafdfa7161bfe8925641c60d26d0cb8bccde..ebd7972c17f761319dbe49a9f72bb1b56fa5a773 100644 (file)
@@ -1,6 +1,7 @@
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
 
 const GLib = imports.gi.GLib;
+const Gio = imports.gi.Gio;
 const Lang = imports.lang;
 const Mainloop = imports.mainloop;
 const St = imports.gi.St;
@@ -86,3 +87,13 @@ var AnimatedIcon = new Lang.Class({
         this.parent(file, size, size, ANIMATED_ICON_UPDATE_TIMEOUT);
     }
 });
+
+var Spinner = new Lang.Class({
+    Name: 'Spinner',
+    Extends: AnimatedIcon,
+
+    _init(size) {
+        let file = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/process-working.svg');
+        this.parent(file, size);
+    }
+});
index 3dd58e828013ac2b2a781f7568a1f7aeb44f7a47..037bc097a952bfd013bf559df9c03ed1d790c505 100644 (file)
@@ -114,8 +114,7 @@ var KeyringDialog = new Lang.Class({
             ShellEntry.addContextMenu(this._passwordEntry, { isPassword: true });
             this._passwordEntry.clutter_text.connect('activate', this._onPasswordActivate.bind(this));
 
-            let spinnerIcon = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/process-working.svg');
-            this._workSpinner = new Animation.AnimatedIcon(spinnerIcon, WORK_SPINNER_ICON_SIZE);
+            this._workSpinner = new Animation.Spinner(WORK_SPINNER_ICON_SIZE);
             this._workSpinner.actor.opacity = 0;
 
             if (rtl) {
index 7a0682c4b17d3dc099da0ce41d1de9390d02d80d..4bcbe30e7fbaa628de77b85457a4f50abe56b54f 100644 (file)
@@ -117,8 +117,7 @@ var AuthenticationDialog = new Lang.Class({
         this._passwordBox.add(this._passwordEntry,
                               { expand: true });
 
-        let spinnerIcon = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/process-working.svg');
-        this._workSpinner = new Animation.AnimatedIcon(spinnerIcon, WORK_SPINNER_ICON_SIZE);
+        this._workSpinner = new Animation.Spinner(WORK_SPINNER_ICON_SIZE);
         this._workSpinner.actor.opacity = 0;
 
         this._passwordBox.add(this._workSpinner.actor);
index d5567dc3c2a443cd693fcd46896ee98eebe83c88..92a00301b2b15a58c3409b4d650c135358f29b08 100644 (file)
@@ -865,8 +865,7 @@ var NMWirelessDialog = new Lang.Class({
                                                  x_align: Clutter.ActorAlign.CENTER,
                                                  y_align: Clutter.ActorAlign.CENTER });
 
-        let file = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/process-working.svg');
-        this._noNetworksSpinner = new Animation.AnimatedIcon(file, 16, 16);
+        this._noNetworksSpinner = new Animation.Spinner(16);
         this._noNetworksBox.add_actor(this._noNetworksSpinner.actor);
         this._noNetworksBox.add_actor(new St.Label({ style_class: 'no-networks-label',
                                                      text: _("No Networks") }));